#!/bin/bash
user=`git config --get user.name`
review=`git config --get remote.qrd.review | sed 's/:.*/:29418/g'`
project=`git config --get remote.qrd.projectname`


if [ -z $1 ];then
repo manifest -o $TMPDIR/tmp.xml
branch=`cat $TMPDIR/tmp.xml  | grep "default.*revision" | sed -n 's/.*revision="\(.*\)"\/>/\1/p'`
rm -f $TMPDIR/tmp.xml
else
branch=$1
fi

set -x
para="ssh://$user@$review/$project.git HEAD:refs/for/$branch"
git push $para
set +x
